<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>Yo商城，欢迎注册</title>
	<link rel="icon" href="./img/favicon.ico">

    <link rel="stylesheet" type="text/css" href="/css/all.css" />
    <link rel="stylesheet" type="text/css" href="/css/pages-login.css" />
	<div th:include="common/head :: head"></div>
</head>

<body>
	<!-- 头部栏位 -->
	<!--页面顶部-->
	<div style="height: 110px; color:#f3f3f3; margin-left: 105px;">
		<div class="yui3-u Left logoArea">
			<a class="logo-bd" title="Yo商城" href="/" target="_blank"></a>
		</div>
	</div>

	<div class="login-box">

		<!--loginArea-->
		<div class="loginArea" style="padding-top: 0px;">
			<div class="py-container login">
				<div class="loginform">
								<h3>账户注册</h3>
					<div class="tab-content tab-wraped">
						<div id="profile" class="tab-pane active">
							<form class="sui-form">
								<div class="input-prepend"><span class="add-on loginname"></span>
									<input id="inputName" type="text" v-model="user.loginName" placeholder="用户名称" class="span2 input-xfat">
								</div>
								<div class="input-prepend"><span class="add-on loginname"></span>
									<input id="nickName" type="text" v-model="user.nickName" placeholder="用户昵称" class="span2 input-xfat">
								</div>
								<div class="input-prepend"><span class="add-on loginpwd"></span>
									<input id="inputPassword" type="password" v-model="user.passwd" placeholder="请输入密码" class="span2 input-xfat">
								</div>
								<div class="input-prepend"><span class="add-on loginname"></span>
									<input id="name" type="text" v-model="user.name" placeholder="用户姓名" class="span2 input-xfat">
								</div>
								<div class="input-prepend"><span class="add-on loginname"></span>
									<input id="phoneNum" type="text" v-model="user.phoneNum" placeholder="手机号" class="span2 input-xfat">
								</div>
								<div class="input-prepend"><span class="add-on loginname"></span>
									<input id="email" type="text" v-model="user.email" placeholder="邮箱" class="span2 input-xfat">
								</div>
								<div class="logined">
									<a class="sui-btn btn-block btn-xlarge btn-danger" href="javascript:" @click="submitRegister()">注&nbsp;&nbsp;册</a>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--foot-->
		<div class="py-container copyright">
			<ul>
				<li>关于我们</li>
				<li>联系我们</li>
				<li>联系客服</li>
				<li>商家入驻</li>
				<li>营销中心</li>
				<li>手机YO</li>
				<li>销售联盟</li>
				<li>YO社区</li>
			</ul>
			<div class="address">地址：北京市昌平区宏福科技园综合楼6层</div>
			<div class="beian">京ICP备19006430号
			</div>
		</div>
	</div>

<!--页面底部END-->
<script src="/js/api/login.js"></script>
<script th:inline="javascript">
	var item = new Vue({
		el: '#profile',

		data: {
            originUrl: [[${originUrl}]],
            user: {
                loginName: '',
				nickName:'',
                passwd: '',
				name:'',
				phoneNum:'',
				email:''
            }
		},

		created() {
		},

		methods: {
			submitRegister() {
                login.register(this.user).then(response => {
                    if (response.data.code == 200) {
                        //把token存在cookie中、也可以放在localStorage中   //SessionStorage
                        auth.setToken(response.data.data.token)
                        auth.setUserInfo(JSON.stringify(response.data.data))
                        if(this.originUrl == ''){
                            window.location.href="http://www.yomall.com"
                            return ;
                        } else {
                            window.location.href = decodeURIComponent(this.originUrl)
						}
                    } else {
						alert(response.data.data.message)
					}

                })
            },
			wxLogin(){
            	console.log("111111111")
				console.log(this.originUrl)
				window.location.href ="http://passport.yomall.com/api/ucenter/wx/login?originUrl="+this.originUrl
			}
        }
	})
</script>
</body>
</html>
